<template>
  <div>
    <button @click="isShow = !isShow">切换</button>
    <!-- 使用transition组件包含被条件渲染的元素，控制其执行动画 -->
    <transition
      enter-active-class="animate__backInDown"
      leave-active-class="animate__backOutDown"
    >
      <div class="box animate__animated" v-if="isShow"></div>
    </transition>
    <br />
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>

<style>
.box {
  width: 100px;
  height: 100px;
  background: red;
}
</style>
